from gaev import actions
from data import models

from gaev.actions.url import get_action_url

def menu_index(title, object):
	return (title, get_action_url('index', object))
def menu_model_index(model):
	return menu_index(model.get_model_caption(), model.entities())
def menu_details(title, model, human_key):
	url=get_action_url('details', model=model, human_key=human_key)
	return (title, url)
def menu_action(title, action):
	url=get_action_url(action, None)
	return (title, url)

menu_definition={'menu_spec':[
		('Highlights',[
		menu_details('SInE', models.ProverInstance, 'sine0def'),
		('SUMO Results', '/static/files/results_E_S_V.html'),
		('MILO Results', '/static/files/results_MILO_S_V.html'),
		]),
		('Data',[
		menu_model_index(models.Division),
		menu_model_index(models.AxiomFamily),
		menu_model_index(models.AxiomSet),
		menu_model_index(models.Problem),
		menu_model_index(models.ProblemGroup),
		menu_model_index(models.Result),
		menu_model_index(models.Proof),
		]),
		('Tools',[
		('Upload data', '/import'),
		('Sample submitter', '/static/files/submitter.txt'),
		menu_action('Cart analyzer', 'cart_analyzer'),
		]),
		('Enumerations',[
		menu_model_index(models.Prover),
		menu_model_index(models.ProverVersion),
		menu_model_index(models.ProverInstance),
		menu_model_index(models.ProblemStatus),
		menu_model_index(models.ResultType),
		menu_model_index(models.ResultEvaluation),
		menu_model_index(models.OutputFormat),
		menu_model_index(models.CPUFamily),
		menu_model_index(models.OS),
		menu_model_index(models.Computer),
		]),
		]}

def menu_processor(request):
	return menu_definition
